clear all;
load('rev.mat','rev')

%% rev, auto, pool tgt

rev=log(rev(:,1:end-1)); % rev: agent,time
rev(isinf(rev))=nan;

nlag=5;
auto(1:nlag,1)=nan;

for lag=1:nlag
    a=rev(:,lag+1:end);
    b=rev(:,1:end-lag);
    auto(lag)=corr(a(:),b(:),'rows','complete');
end

%% rev growth, std, hh mean
rev_growth=rev(:,2:end)-rev(:,1:end-1);


std_hh=std(rev_growth','omitnan');
std_hh_mean=mean(std_hh,'omitnan');